import numpy as np
import matplotlib.pyplot as plt
from next_level.Finance_Data.stock_load import load_stock

'''
绘制两支股票的收盘价，依赖文件为 stock_load.py
'''

def do_plot(stock_df):
    '''绘图函数，需要使用从网络获取的股票数据 stock_df'''
    column = stock_df.Close
    column = np.array(column,dtype='float')
    date = np.array(stock_df.Date)
    plt.plot(date,column,label='closing price')
    plt.legend()   # 为图形添加图例
    plt.title('MSFT Stock Price')
    plt.show()

if __name__ == '__main__':
    stock_df = load_stock('MSFT')
    do_plot(stock_df)
    # stock_df = load_stock('AAPL')
    # do_plot(stock_df)

